﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Tour.Linq.TourDBML;
public partial class AdminManager_Admin_TypeManager : AdminBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DisplayInfo();
        }
    }

    private void DisplayInfo()
    {
        TypeListView.DataSource = TourStaticData.TreeTourType;
        TypeListView.DataBind();
    }
    protected void TypeListView_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        if (e.CommandName == "DeleteItem")
        {
            TourType model = TourContext.TourType.First(t => t.ID == e.CommandArgument.ToInt());
            if (model != null)
            {
                TourContext.TourType.DeleteOnSubmit(model);
                TourContext.SubmitChanges();
                TourStaticData.Clean();
                _Message = "删除类别成功";
            }
        }
        DisplayInfo();
    }
}
